package com.party.core.model.charge;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 产品类型枚举
 * Created by wei.li
 *
 * @date 2017/6/26 0026
 * @time 16:23
 */
public enum ProductType {

    PACKAGE_TYPE(1, "套餐"),

    MODULE_TYPE(2, "模块"),

    SMS_PACKAGE_TYPE(3, "短信套餐"),

    SYSTEM_TYPE(4, "系统");

    //状态码
    private Integer code;

    //状态值
    private String value;

    ProductType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (ProductType roleType : ProductType.values()) {
            if (roleType.getCode().equals(code)) {
                return roleType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap() {
        Map<Integer, String> map = Maps.newHashMap();
        for (ProductType roleType : ProductType.values()) {
            map.put(roleType.getCode(), roleType.getValue());
        }
        return map;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
